<template>
  <div class="row justify-content-center">
    <div class="col-8">
      <form name="editForm" role="form" novalidate v-on:submit.prevent="save()">
        <h2 id="roomAdminApp.roomRentBasic.home.createOrEditLabel" data-cy="RoomRentBasicCreateUpdateHeading">
          Create or edit a RoomRentBasic
        </h2>
        <div>
          <div class="form-group" v-if="roomRentBasic.id">
            <label for="id">ID</label>
            <input type="text" class="form-control" id="id" name="id" v-model="roomRentBasic.id" readonly />
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-care">Care</label>
            <b-input-group class="mb-3">
              <b-input-group-prepend>
                <b-form-datepicker
                  aria-controls="room-rent-basic-care"
                  v-model="$v.roomRentBasic.care.$model"
                  name="care"
                  class="form-control"
                  :locale="currentLanguage"
                  button-only
                  today-button
                  reset-button
                  close-button
                >
                </b-form-datepicker>
              </b-input-group-prepend>
              <b-form-input
                id="room-rent-basic-care"
                data-cy="care"
                type="text"
                class="form-control"
                name="care"
                :class="{ valid: !$v.roomRentBasic.care.$invalid, invalid: $v.roomRentBasic.care.$invalid }"
                v-model="$v.roomRentBasic.care.$model"
              />
            </b-input-group>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-parking">Parking</label>
            <input
              type="text"
              class="form-control"
              name="parking"
              id="room-rent-basic-parking"
              data-cy="parking"
              :class="{ valid: !$v.roomRentBasic.parking.$invalid, invalid: $v.roomRentBasic.parking.$invalid }"
              v-model="$v.roomRentBasic.parking.$model"
            />
            <div v-if="$v.roomRentBasic.parking.$anyDirty && $v.roomRentBasic.parking.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.parking.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-electricity">Electricity</label>
            <input
              type="text"
              class="form-control"
              name="electricity"
              id="room-rent-basic-electricity"
              data-cy="electricity"
              :class="{ valid: !$v.roomRentBasic.electricity.$invalid, invalid: $v.roomRentBasic.electricity.$invalid }"
              v-model="$v.roomRentBasic.electricity.$model"
            />
            <div v-if="$v.roomRentBasic.electricity.$anyDirty && $v.roomRentBasic.electricity.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.electricity.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-lease">Lease</label>
            <input
              type="text"
              class="form-control"
              name="lease"
              id="room-rent-basic-lease"
              data-cy="lease"
              :class="{ valid: !$v.roomRentBasic.lease.$invalid, invalid: $v.roomRentBasic.lease.$invalid }"
              v-model="$v.roomRentBasic.lease.$model"
            />
            <div v-if="$v.roomRentBasic.lease.$anyDirty && $v.roomRentBasic.lease.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.lease.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-occupancy">Occupancy</label>
            <b-input-group class="mb-3">
              <b-input-group-prepend>
                <b-form-datepicker
                  aria-controls="room-rent-basic-occupancy"
                  v-model="$v.roomRentBasic.occupancy.$model"
                  name="occupancy"
                  class="form-control"
                  :locale="currentLanguage"
                  button-only
                  today-button
                  reset-button
                  close-button
                >
                </b-form-datepicker>
              </b-input-group-prepend>
              <b-form-input
                id="room-rent-basic-occupancy"
                data-cy="occupancy"
                type="text"
                class="form-control"
                name="occupancy"
                :class="{ valid: !$v.roomRentBasic.occupancy.$invalid, invalid: $v.roomRentBasic.occupancy.$invalid }"
                v-model="$v.roomRentBasic.occupancy.$model"
              />
            </b-input-group>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-water">Water</label>
            <input
              type="text"
              class="form-control"
              name="water"
              id="room-rent-basic-water"
              data-cy="water"
              :class="{ valid: !$v.roomRentBasic.water.$invalid, invalid: $v.roomRentBasic.water.$invalid }"
              v-model="$v.roomRentBasic.water.$model"
            />
            <div v-if="$v.roomRentBasic.water.$anyDirty && $v.roomRentBasic.water.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.water.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-gas">Gas</label>
            <input
              type="text"
              class="form-control"
              name="gas"
              id="room-rent-basic-gas"
              data-cy="gas"
              :class="{ valid: !$v.roomRentBasic.gas.$invalid, invalid: $v.roomRentBasic.gas.$invalid }"
              v-model="$v.roomRentBasic.gas.$model"
            />
            <div v-if="$v.roomRentBasic.gas.$anyDirty && $v.roomRentBasic.gas.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.gas.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-createdBy">Created By</label>
            <input
              type="text"
              class="form-control"
              name="createdBy"
              id="room-rent-basic-createdBy"
              data-cy="createdBy"
              :class="{ valid: !$v.roomRentBasic.createdBy.$invalid, invalid: $v.roomRentBasic.createdBy.$invalid }"
              v-model="$v.roomRentBasic.createdBy.$model"
            />
            <div v-if="$v.roomRentBasic.createdBy.$anyDirty && $v.roomRentBasic.createdBy.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.createdBy.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-createdDate">Created Date</label>
            <div class="d-flex">
              <input
                id="room-rent-basic-createdDate"
                data-cy="createdDate"
                type="datetime-local"
                class="form-control"
                name="createdDate"
                :class="{ valid: !$v.roomRentBasic.createdDate.$invalid, invalid: $v.roomRentBasic.createdDate.$invalid }"
                :value="convertDateTimeFromServer($v.roomRentBasic.createdDate.$model)"
                @change="updateInstantField('createdDate', $event)"
              />
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-lastModifiedBy">Last Modified By</label>
            <input
              type="text"
              class="form-control"
              name="lastModifiedBy"
              id="room-rent-basic-lastModifiedBy"
              data-cy="lastModifiedBy"
              :class="{ valid: !$v.roomRentBasic.lastModifiedBy.$invalid, invalid: $v.roomRentBasic.lastModifiedBy.$invalid }"
              v-model="$v.roomRentBasic.lastModifiedBy.$model"
            />
            <div v-if="$v.roomRentBasic.lastModifiedBy.$anyDirty && $v.roomRentBasic.lastModifiedBy.$invalid">
              <small class="form-text text-danger" v-if="!$v.roomRentBasic.lastModifiedBy.maxLength">
                This field cannot be longer than 32 characters.
              </small>
            </div>
          </div>
          <div class="form-group">
            <label class="form-control-label" for="room-rent-basic-lastModifiedDate">Last Modified Date</label>
            <div class="d-flex">
              <input
                id="room-rent-basic-lastModifiedDate"
                data-cy="lastModifiedDate"
                type="datetime-local"
                class="form-control"
                name="lastModifiedDate"
                :class="{ valid: !$v.roomRentBasic.lastModifiedDate.$invalid, invalid: $v.roomRentBasic.lastModifiedDate.$invalid }"
                :value="convertDateTimeFromServer($v.roomRentBasic.lastModifiedDate.$model)"
                @change="updateInstantField('lastModifiedDate', $event)"
              />
            </div>
          </div>
        </div>
        <div>
          <button type="button" id="cancel-save" data-cy="entityCreateCancelButton" class="btn btn-secondary" v-on:click="previousState()">
            <font-awesome-icon icon="ban"></font-awesome-icon>&nbsp;<span>Cancel</span>
          </button>
          <button
            type="submit"
            id="save-entity"
            data-cy="entityCreateSaveButton"
            :disabled="$v.roomRentBasic.$invalid || isSaving"
            class="btn btn-primary"
          >
            <font-awesome-icon icon="save"></font-awesome-icon>&nbsp;<span>Save</span>
          </button>
        </div>
      </form>
    </div>
  </div>
</template>
<script lang="ts" src="./room-rent-basic-update.component.ts"></script>
